// 基础色彩类型定义
export interface RGB {
  r: number; // 0-255
  g: number; // 0-255
  b: number; // 0-255
}

export interface HSL {
  h: number; // 0-360
  s: number; // 0-100
  l: number; // 0-100
}

export interface HSV {
  h: number; // 0-360
  s: number; // 0-100
  v: number; // 0-100
}

// 色彩模型
export interface Color {
  hex: string;
  rgb: RGB;
  hsl: HSL;
  hsv: HSV;
  name?: string;
  tags?: string[];
  createdAt?: Date;
}

// 色彩搭配类型
export type ColorSchemeType = 'complementary' | 'analogous' | 'triadic' | 'tetradic' | 'custom' | 'monochromatic';

// 色彩方案
export interface ColorScheme {
  id: string;
  name: string;
  colors: Color[];
  type: ColorSchemeType;
  createdAt: Date;
  updatedAt: Date;
  tags: string[];
  isFavorite: boolean;
  description?: string;
}

// 用户偏好设置
export interface UserPreferences {
  defaultColorMode: 'rgb' | 'hsl' | 'hex' | 'hsv';
  theme: 'light' | 'dark' | 'auto';
  language: 'zh-CN' | 'en-US';
  autoSave: boolean;
  maxHistoryItems: number;
  showColorNames: boolean;
  enableAnimations: boolean;
}

// 用户数据
export interface User {
  id: string;
  username: string;
  email: string;
  preferences: UserPreferences;
  createdAt: Date;
  lastLoginAt?: Date;
}

// 色彩使用统计
export interface ColorUsageStats {
  totalSchemes: number;
  favoriteColors: Color[];
  colorDistribution: { [hueRange: string]: number };
  averageColorsPerScheme: number;
  creationFrequency: { [date: string]: number };
  mostUsedTypes: { [type: string]: number };
}

// 活动数据
export interface ActivityData {
  date: string;
  schemesCreated: number;
  colorsSelected: number;
  timeSpent: number; // 分钟
}

// 数据导出格式
export interface UserDataExport {
  user: User | null;
  schemes: ColorScheme[];
  preferences: UserPreferences;
  stats: ColorUsageStats;
  exportDate: Date;
  version: string;
}

// 色彩选择器模式
export type ColorPickerMode = 'simple' | 'advanced' | 'palette';

// 推荐类型
export type RecommendationType = 'personal' | 'trending' | 'seasonal' | 'theory-based';

// 搜索筛选选项
export interface SearchFilters {
  colorRange?: {
    hue?: [number, number];
    saturation?: [number, number];
    lightness?: [number, number];
  };
  dateRange?: {
    start: Date;
    end: Date;
  };
  tags?: string[];
  schemeType?: ColorSchemeType[];
  isFavorite?: boolean;
}